<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<style type="text/css">
.ui-layout-north {
	z-index: 20 !important;
	overflow: visible !important;;
}

.ui-layout-north .ui-layout-unit-content {
	overflow: visible !important;
}

.ui-widget {
	font-size: 9px !important;
}

.size {
	width: 750px;
	position: relative;
	left: 18%;
	top: 10%;
}

.centro {
	top: 50%
}

.tabela {
	width: 750px;
}
</style>

	<title>Manutenção de Matrícula</title>
</h:head>

<h:body>
	<ui:decorate template="/templateBase.xhtml">
		<ui:define name="center">
			<p:growl life="3000" id="growl" autoUpdate="true" />
			<h:form id="formManutencao">
				<br />
				<br />
				<br />
				<p:panel header="Manutenção de Matrícula" styleClass="size"
					footer="Integração - Portal de Serviços e Comunicação">
					<br />
					<h:panelGrid columns="4">
						<h:outputText value="Período Letivo: " />
						<p:inputText size="10" maxlength="6"
							value="#{mantMatricBacking.codLetivo}">
							<p:ajax listener="#{mantMatricBacking.selecionaPerLetivo}"
								event="blur" process="@this" update="txtPeriodo" />
						</p:inputText>
						<p:inputText size="40" maxlength="50" disabled="true"
							id="txtPeriodo"
							value="#{mantMatricBacking.periodoSelecionado.descricao}" />
						<p:commandButton icon="ui-icon-search" />

						<h:outputText value="ID Aluno: " />
						<p:inputText size="10" maxlength="6"
							value="#{mantMatricBacking.idOrion}">
							<p:ajax listener="#{mantMatricBacking.selecionaPerLetivo}"
								event="blur" update="txtAluno" process="@this" />
						</p:inputText>
						<p:inputText size="50" maxlength="55" disabled="true"
							id="txtAluno" value="#{mantMatricBacking.alunoSelecionado.nome}" />
						<p:commandButton icon="ui-icon-search" />

						<h:outputText value="Curso: " />
						<p:inputText size="10" maxlength="6"
							value="#{mantMatricBacking.codCurso}">
							<p:ajax listener="#{mantMatricBacking.selecionaPerLetivo}"
								event="blur" process="@this"
								update="txtMatric,txtSem,txtTurno,tabVw1,txtTipo" />
						</p:inputText>
						<p:inputText size="50" maxlength="50" disabled="true"
							value="#{mantMatricBacking.matricSelecionada.curso.nome}"
							id="txtMatric" />
						<p:commandButton icon="ui-icon-search" />

					</h:panelGrid>

					<h:panelGrid columns="6" cellspacing="5">
						<h:outputText value="Semestre .....:" />
						<p:inputText size="4" disabled="true"
							value="#{mantMatricBacking.matricSelecionada.serie}" id="txtSem" />
						<h:outputText value="Turma" />
						<p:inputText size="4" maxlength="2" disabled="true" id="txtTipo"
							value="#{mantMatricBacking.matricSelecionada.tipo}" />
						<h:outputText value="Turno" />
						<p:inputText size="33" maxlength="30" disabled="true"
							value="#{mantMatricBacking.matricSelecionada.turno}"
							id="txtTurno" />
					</h:panelGrid>
					<br />
					<p:separator />
					<br />
					<p:tabView id="tabVw1">
						<p:tab title="Turmas do Curso" id="tab1">

							<h:outputText value="Disciplinas do curso sendo oferecidas" />
							<br />
							<br />
							<p:dataTable value="#{mantMatricBacking.listaTurma}" var="t"
								id="tblTmaCurso" rows="7" paginator="true"
								selection="#{mantMatricBacking.turmaSelecionada}"
								rowKey="#{t.id}">
								<p:column selectionMode="multiple">

								</p:column>
								<p:column headerText="ID Turma">
									<h:outputText value="#{t.id}" />
								</p:column>
								<p:column headerText="Série">
									<h:outputText value="#{t.serie}" />
								</p:column>
								<p:column headerText="Tipo">
									<h:outputText value="#{t.descricao}" />
								</p:column>
								<p:column headerText="ID Disciplina">
									<h:outputText value="#{t.disciplina.id}" />
								</p:column>
								<p:column headerText="Nome">
									<h:outputText value="#{t.disciplina.nome}" />
								</p:column>
								<p:column headerText="Docente">
									<h:outputText value="#{t.docente.nome}" />
								</p:column>
							</p:dataTable>
							<br />
							<div align="center">
								<h:panelGrid columns="2">
									<p:commandButton icon="ui-icon-disk"
										value="Matricular na(s) turma(s)."
										actionListener="#{mantMatricBacking.finalizaMatricula}"
										update="tabMatric" />
									<p:commandButton value="Cancelar" />
								</h:panelGrid>
							</div>
						</p:tab>

						<p:tab title="Turmas Avulsas">
							<h:outputText
								value="Informe o curso que deseja contratar as turmas:" />
							<br />
							<br />
							<h:panelGrid columns="4">
								<h:outputText value="ID:" />
								<p:inputText size="7"
									value="#{mantMatricBacking.codCursoAvulso}">
									<p:ajax listener="#{mantMatricBacking.criaListaTurmaAvulsa}"
										event="blur" process="@this" update="tblTmaAvulsa, txtCurso" />
								</p:inputText>
								<p:inputText size="50" disabled="true"
									value="#{mantMatricBacking.cursoAvulsoSelecionado.nome}"
									id="txtCurso" />
								<p:commandButton icon="ui-icon-search" />
							</h:panelGrid>
							<br />
							<p:dataTable value="#{mantMatricBacking.listaTurmaAvulsa}"
								id="tblTmaAvulsa" var="tAv" rows="7" paginator="true"
								selection="#{mantMatricBacking.turmaAvulsaSelecionada}"
								rowKey="#{tAv.id}">

								<p:column selectionMode="multiple">

								</p:column>

								<p:column headerText="ID Turma">
									<h:outputText value="#{tAv.id}" />
								</p:column>
								<p:column headerText="Série">
									<h:outputText value="#{tAv.serie}" />
								</p:column>
								<p:column headerText="Tipo">
									<h:outputText value="#{tAv.descricao}" />
								</p:column>
								<p:column headerText="ID Disciplina">
									<h:outputText value="#{tAv.disciplina.id}" />
								</p:column>
								<p:column headerText="Nome">
									<h:outputText value="#{tAv.disciplina.nome}" />
								</p:column>
								<p:column headerText="Docente">
									<h:outputText value="#{tAv.docente.nome}" />
								</p:column>
							</p:dataTable>
							<br />
							<div align="center">
								<h:panelGrid columns="2">
									<p:commandButton icon="ui-icon-disk"
										value="Matricular na(s) turma(s)"
										actionListener="#{mantMatricBacking.finalizaMatriculaAvulsa}"
										update="tabMatric" />
									<p:commandButton value="Cancelar" />
								</h:panelGrid>
							</div>
						</p:tab>

						<p:tab title="Turmas Matriculadas">
							<h:outputText value="Turmas matriculadas até o momento:" />
							<br />
							<br />
							<p:dataTable value="#{mantMatricBacking.listaTurmasMatriculadas}"
								var="tmt" id="tabMatric" rows="7" paginator="true">
								<p:column headerText="ID Turma">
									<h:outputText value="#{tmt.turma.id}" />
								</p:column>
								<p:column headerText="Série">
									<h:outputText value="#{tmt.turma.serie}" />
								</p:column>
								<p:column headerText="Tipo">
									<h:outputText value="#{tmt.turma.descricao}" />
								</p:column>
								<p:column headerText="ID Disciplina">
									<h:outputText value="#{tmt.turma.disciplina.id}" />
								</p:column>
								<p:column headerText="Nome">
									<h:outputText value="#{tmt.turma.disciplina.nome}" />
								</p:column>
								<p:column headerText="Docente">
									<h:outputText value="#{tmt.turma.docente.nome}" />
								</p:column>
							</p:dataTable>
							<br />
							<div align="center">
								<h:panelGrid columns="2">
									<p:commandButton icon="ui-icon-disk" value="Finalizar" />
									<p:commandButton value="Cancelar" />
								</h:panelGrid>
							</div>
						</p:tab>
					</p:tabView>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:decorate>
</h:body>
</html>